t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print('Alice' if max(a) >= max(b) else 'Bob')
print('Alice' if max(a) > max(b) else 'Bob')
#include<bits/stdc++.h>
#define int long long
#define sub substr
#define L(i,j,k) for(int i=(j);i<=(k);i++)
#define R(i,j,k) for(int i=(j);i>=(k);i--)
#define inf 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define MS(i,j) memset(i,j,sizeof (i))
#define T__ int T;cin>>T;while(T--){solve();}
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define dbg(x) system("color");cerr<<"\033[35;1m"<<#x<<" is "<<x<<"\n"<<"\033[39;0m";
using namespace std;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
return x*f;
}
inline void print(int x) {
if(x<0){putchar('-');x=-x;}
if(x/10)print(x/10);
putchar(x%10+'0');
}
int gcd(int x,int y){if(y==0) return x;return gcd(y,x%y);}//�������
int lowbit(int x){return x&(-x);}
//lower_bound(a,a+n,x)-a ���ֲ���
//upper_bound(a,a+n,x)-a
int dx[5]={0,1,0,-1},dy[5]={1,0,-1,0};//����
struct node{
int w;
int v;
};
bool cmp(int a,int b){
return a > b;
}
/*bool cmp1(struct node u,struct node v){
return u.hao>v.hao;
}
bool cmp2(struct node u,struct node v){
return u.shi<v.shi;
}*/
bool cmpl(int u,int v){return u>v;}
struct cmps{
int x;
bool operator < (const cmps &a)const{ return a.x < x;/*return a.x > x;*/}
};
//vector<ll> v;
//priority_queue<cmps> sp;
//queue<ll> sq;
//stack<ll> st;
//map<ll,ll> mp;
//pair<ll,ll> p;
void solve(){
int n,m;
cin>>n;
int max1 = -1e18,max2 = -1e18;
L(i,1,n){
int x;
cin>>x;
max1 = max(max1,x);
}
cin>>m;
L(i,1,m){
int y;
cin>>y;
max2 = max(max2,y);
}
if(max1 == max2){
cout<<"Alice"<<"\n";
cout<<"Bob"<<"\n";
return;
}
if(max1 > max2){
cout<<"Alice"<<"\n";
cout<<"Alice"<<"\n";
return;
}else{
cout<<"Bob"<<"\n";
cout<<"Bob"<<"\n";
return;
}
}
signed main(){
IOS;
T__
//solve();
return 0;
}
20. Valid Parentheses | 746. Min Cost Climbing Stairs |
392. Is Subsequence | 70. Climbing Stairs |
53. Maximum Subarray | 1527A. And Then There Were K |
1689. Partitioning Into Minimum Number Of Deci-Binary Numbers | 318. Maximum Product of Word Lengths |
448. Find All Numbers Disappeared in an Array | 1155. Number of Dice Rolls With Target Sum |
415. Add Strings | 22. Generate Parentheses |
13. Roman to Integer | 2. Add Two Numbers |
515. Find Largest Value in Each Tree Row | 345. Reverse Vowels of a String |
628. Maximum Product of Three Numbers | 1526A - Mean Inequality |
1526B - I Hate 1111 | 1881. Maximum Value after Insertion |
237. Delete Node in a Linked List | 27. Remove Element |
39. Combination Sum | 378. Kth Smallest Element in a Sorted Matrix |
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |